mp = {None:[None,None]}
Tag = {None:None}
code = []
inp = input()
inif = [1]
np = 0
def isnum(str):
    if str[0] == '+' or str[0] == '-':
        str = str[1:len(str)]
    return str.isdigit()
while inp != 'End':
    if inp.split()[0] == 'Tag':
        Tag[inp.split()[1]] = len(code)
    code.append(inp.split())
    inp=input()
code.append('End')
while code[np] != 'End':
    lst = code[np]
    np = np+1
    if lst[0] == 'Tag':
        continue
    if lst[0] == 'Endif':
        inif.pop()
        continue
    if lst[0] == 'Else':
        inif[len(inif)-1] = not inif[len(inif)-1]
        continue
    if not inif[len(inif)-1]:
        continue
    if lst[0] == 'Create':
        mp[lst[1]] = [None,None]
    elif lst[0] == 'Assign':
        name = lst[1]
        type = lst[2]
        val = lst[3]
        if type == '(int)':
            mp[name] = [int(val),'int']
        elif type == '(float)':
            mp[name] = [float(val),'float']
        elif type == '(bool)':
            mp[name] = [bool(val),'bool']
        elif type == '(str)':
            mp[name] = [val,'str']
        elif type == '(list)':
            mp[name] = [eval(val),'list']
    elif lst[0] == 'Print':
        print(mp[lst[1]][0],end='')
    elif lst[0] == 'Printblank':
        print(' ',end='')
    elif lst[0] == 'Println':
        print('')
    elif lst[0] == 'Copy':
        type = lst[1]
        val = None
        name = lst[len(lst)-1]
        if len(lst) == 4:
            val = mp[lst[2]][0]
        elif isnum(lst[3]):
            val = mp[lst[2]][0][int(lst[3])]
        else:
            val = mp[lst[2]][0][int(mp[lst[3]][0])]
        if type == '(int)':
            mp[name] = [int(val), 'int']
        elif type == '(float)':
            mp[name] = [float(val), 'float']
        elif type == '(bool)':
            mp[name] = [bool(val), 'bool']
        elif type == '(str)':
            mp[name] = [str(val), 'str']
        elif type == '(list)':
            mp[name] = [list(val), 'list']
    elif lst[0] == 'Add':
        if not isnum(lst[2]):
            mp[lst[1]][0] += mp[lst[2]][0]
        else:
            mp[lst[1]][0] += int(lst[2])
    elif lst[0] == 'Neg':
        mp[lst[1]][0] = -mp[lst[1]][0]
    elif lst[0] == 'Mul':
        if not isnum(lst[2]):
            mp[lst[1]][0] *= mp[lst[2]][0]
        else:
            mp[lst[1]][0] *= int(lst[2])
    elif lst[0] == 'Div':
        if not isnum(lst[2]):
            mp[lst[1]][0] /= mp[lst[2]][0]
        else:
            mp[lst[1]][0] /= int(lst[2])
    elif lst[0] == 'Readline':
        mp[lst[1]] = [input(),'str']
    elif lst[0] == 'Split':
        if len(lst)==2:
            val=mp[lst[1]][0].split()
        else:
            val=mp[lst[1]][0].split(lst[2])
        mp[lst[1]] = [val,'list']
    elif lst[0] == 'And':
        if lst[2] != '0' and lst[2] != '1' and lst[2].lower != 'true' and lst[2].upper != 'false':
            mp[lst[1]][0] = mp[lst[1]][0] and mp[lst[2]][0]
        else:
            mp[lst[1]][0] = mp[lst[1]][0] and bool(lst[2])
    elif lst[0] == 'Judgeless':
        if not isnum(lst[2]):
            mp[lst[3]][0] = mp[lst[1]][0] < mp[lst[2]][0]
        else:
            mp[lst[3]][0] = mp[lst[1]][0] < int(lst[2])
    elif lst[0] == 'If':
        inif.append(mp[lst[1]][0])
    elif lst[0] == 'Goto':
        np = Tag[lst[1]]
    elif lst[0] == 'Append':
        if not isnum(lst[2]):
            mp[lst[1]][0].append(mp[lst[2]][0])
        else:
            mp[lst[1]][0].append(lst[2])
    elif lst[0] == 'Pop':
        mp[lst[1]][0].pop()
    elif lst[0] == 'Sort':
        mp[lst[1]][0].sort()
    elif lst[0] == 'Reverse':
        mp[lst[1]][0].reverse()
    elif lst[0] == 'Changepos':
        pos = None
        type = lst[3]
        if not isnum(lst[2]):
            pos = mp[lst[2]][0]
        else:
            pos = int(lst[2])
        val = None
        if isnum(lst[4]):
            val = int(lst[4])
        else:
            val = mp[lst[4]][0]
        clist = lst[1]
        if type == '(int)':
            mp[clist][0][pos] = int(val)
        elif type == '(float)':
            mp[clist][0][pos] = float(val)
        elif type == '(bool)':
            mp[clist][0][pos] = bool(val)
        elif type == '(str)':
            mp[clist][0][pos] = str(val)
        elif type == '(list)':
            mp[clist][0][pos] = list(val)
